<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>设置我的密码</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="/asset/layui/css/layui.css" media="all">
</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">修改密码</div>
                <div class="layui-card-body" pad15>

                    <div class="layui-form" lay-filter="form">
                        <div class="layui-form-item">
                            <label class="layui-form-label">新密码<span style="color: red">*</span></label>
                            <div class="layui-input-inline">
                                <input type="password" class="layui-input" name="password" autocomplete="new-password" lay-verify="required">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">确认新密码<span style="color: red">*</span></label>
                            <div class="layui-input-inline">
                                <input type="password" class="layui-input" name="repassword" autocomplete="new-password" lay-verify="required">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="update">确认修改</button>
                            </div>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<script src="/asset/layui/layui.js"></script>
<script src="/my/fast.js"></script>
<script>
    // 接口地址
    let sysUser_updatePassword = UPMS_ADDRESS + '/sysUser/updatePassword'

    layui.use(() => {
        let $ = layui.$;
        let form = layui.form;

        // 监听表单提交--add
        form.on('submit(update)', obj => {
            if (obj.field.password !== obj.field.repassword) {
                layer.msg('两次密码输入不一致');
                return
            }
            layuiSubmitAsPostBody(sysUser_updatePassword, obj.field, null, () => {
                layer.msg('修改成功');
                setTimeout(() => {
                    parent.location.reload();
                }, 1000);
            });
        });

    });
</script>
</body>
</html>
